package net.sk.china.front.service.impl.product;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sk.china.common.model.product.StoreProductAttr;
import net.sk.china.front.dao.product.StoreProductAttrDao;
import net.sk.china.front.service.product.StoreProductAttrService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * StoreProductAttrServiceImpl 接口实现
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/12 16:38
 * +----------------------------------------------------------------------
 */

@Service
public class StoreProductAttrServiceImpl extends ServiceImpl<StoreProductAttrDao, StoreProductAttr> implements StoreProductAttrService {

    @Resource
    private StoreProductAttrDao dao;

    /**
     * 获取商品规格列表
     * @param productId 商品id
     * @param type 商品类型
     * @return {@code List<StoreProductAttr>}
     */
    @Override
    public List<StoreProductAttr> getListByProductIdAndType(Integer productId, Integer type) {
        LambdaQueryWrapper<StoreProductAttr> query = new LambdaQueryWrapper<>();
        query.eq(StoreProductAttr::getProductId, productId);
        query.eq(StoreProductAttr::getType, type);
        query.eq(StoreProductAttr::getIsDel, false);

        return dao.selectList(query);
    }
}
